
#ifndef		__ANIMATION_H
#define		__ANIMATION_H

#include	"Object.h"

class Animation : public Object {
	
	private:
		int numFrames;
		int fps;
		int currentFrame;
		int frameTime;

		bool playing;

		int framesCols, framesRows;

		SDL_Rect frameRect;

		void nextFrame();

	public:
		Animation();

		bool init(char* file, int frameWidth, int frameHeight, int fps = 30);
		void loop();
		void render(SDL_Surface*);
		void cleanup();

		bool repeat;

		void play();
		void stop();
		void rewind();

		bool isPlaying() { return playing; }

};

#endif
